package com.springboot.study.controller;
import com.springboot.study.producer.OrderProducer;
import org.springframework.web.bind.annotation.*;
import java.util.UUID;

@RestController
@RequestMapping("/order")
public class OrderController {

    private final OrderProducer orderProducer;

    public OrderController(OrderProducer orderProducer) {
        this.orderProducer = orderProducer;
    }

    @GetMapping("/create")
    public String createOrder() {
        String orderId = UUID.randomUUID().toString();
        orderProducer.sendOrder(orderId);
        return "订单已创建，订单ID：" + orderId;
    }
}
